Updated CMake and used [[maybe_unused]] if available.#168
Updated CMake and used [[maybe_unused]] if available.#168wermos wants to merge 3 commits intoromeric:masterfrom
[[maybe_unused]] if available.#168Conversation
|
Currently, there is no way to have CMake do something like "use C++20 if available, but if it's not, then fallback to 17, and if that's not available, fall back to 14, and if that's not available, then abort compilation." This "decaying" behavior is available, but it's all or nothing: If we enable it (which is what it's currently doing), then it keeps decaying until it finds a version that the compiler supports (which might be, say, C++11 or even C++98). There is however, one thing we can do: set the value of |
|
Not sure why the build is failing. What version of C++ does "Visual Studio 16 2019" have? |
In the top-level,
CMakeLists.txtI specificed the project language and also put the C++ version language as 14 because inFastor/config/config.h, the compilation is set to error out if the compiler doesn't at least support C++14.I also modified the test for C++20 because after the release of C++20, the proper way to check for support is to check if
__cplusplusis defined to be202002Lor not.Finally, I changed the use of the
[[gnu::unused]]to[[maybe_unused]]if available and compiler-specific pragmas otherwise, because[[gnu::unused]]was emitting errorC5030on MSVC v19.35 (attribute 'gnu::unused' is not recognized).